package com.example.shouybl.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;

import com.example.shouybl.R;
import com.example.shouybl.bean.MoneyData;
import com.example.shouybl.utils.ImageLoaderUtil;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by Administrator on 2015/10/12.
 */
public class MoneyAdapter extends AppBaseAdapter<MoneyData> {
    private final DisplayImageOptions options;
    public MoneyAdapter(List<MoneyData> list, Context context) {
        super(list, context);
        options = ImageLoaderUtil.getDefaultOptions();
    }

    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        MoneyData data=list.get(position);
        ViewHolder vh=ViewHolder.get(context,convertView,parent, R.layout.item_money_layout);
        ImageView ivIcon= (ImageView) vh.findViewById(R.id.iv_money_icon);
        ImageView ivDownload= (ImageView) vh.findViewById(R.id.iv_download);
        RatingBar rbMoney= (RatingBar) vh.findViewById(R.id.rb_money);
        TextView tvName= (TextView) vh.findViewById(R.id.tv_money_name);
        TextView tvMsg= (TextView) vh.findViewById(R.id.tv_money_msg);
        TextView tvJife= (TextView) vh.findViewById(R.id.tv_money_jife);

        ImageLoader.getInstance().displayImage(data.getIcon(),ivIcon,options);
        tvName.setText(data.getName());
        tvMsg.setText(data.getCount_dl()+"人下载   "+data.getSize());
        tvJife.setText("奖"+data.getDl_back_jifen()+"Q币");

        return vh;
    }
}
